package com.wn.cloud.common.response;

import com.wn.cloud.common.constant.ResponseEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @FileName: DataResult
 * @Description: TODO
 * @Author: MaWenHao
 * @Created: 2020/3/8 - 0:35
 * @Version: V1.0
 * @Company: 东方微银科技（北京）有限公司
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DataResult<T> extends CommonResult {

    private T data;

    public static <V> DataResult<V> genDataResult(ResponseEnum responseEnum, V data) {
        DataResult<V> dataResult = new DataResult<>(data);
        dataResult.setCode(responseEnum.getCode());
        dataResult.setMessage(responseEnum.getMessage());
        return dataResult;
    }
}
